'''
Author: thinktanker thinktanker@163.com
Date: 2023-01-30 10:26:11
LastEditors: thinktanker thinktanker@163.com
LastEditTime: 2023-01-30 11:18:39
FilePath: \wxtest\swpng.py
Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
'''
import requests
import time
import os


# print(int(time.time() * 1000))
# print(os.path.abspath(os.curdir) )#获取当前工作目录路径
def getswpng(ID_list: list):
    local_path = os.path.abspath(os.curdir)
    # ID_list = [
    #     '9789b39bf27b4f338820f1fa6eef84e7', 'ec4ccb4a8af049ceb1a6517506f14e6f',
    #     '746369696c4b4cf09d1a652aa845c94c', '121f7ca1797644b0b6a1a2e45b03b604'
    # ]
    url = 'http://www.jsswj.com.cn:88/jsswxxSSI/static/map1/0/3/{}.png?t={}/'
    # url = url.format(xinzhaID, int(time.time() * 1000))
    for _ID in ID_list:
        url = 'http://www.jsswj.com.cn:88/jsswxxSSI/static/map1/0/3/{}.png?t={}/'.format(
            _ID, int(time.time() * 1000))
        resp = requests.get(url=url)
        print(url)
        if resp:
            with open(f"{local_path}{os.sep}data{os.sep}{_ID}.png", 'wb') as f:
                f.write(resp.content)
        # time.sleep(0.5)
